﻿using System;
using DotConferenceCore.Logistique;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;

namespace TestDotConferenceCore
{
    [TestFixture]
    public class TestPlanificationConference
    {
        private Conference laConference;

        [SetUp]
        public void Init()
        {
            laConference = new Conference(new DateTime(2009,02,10, 08,00,00), new DateTime(2009,02,15, 17,00,00));
        }

        [Test]
        public void AjoutSessionSurPlusieursJours()
        {
            var session1 = new Session(new DateTime(2009, 02, 10, 08, 00, 00), new DateTime(2009, 02, 10, 17, 00, 00));

            var session2 = new Session(new DateTime(2009, 02, 11, 08, 00, 00), new DateTime(2009, 02, 11, 17, 00, 00));

            var session3 = new Session(new DateTime(2009, 02, 12, 08, 00, 00), new DateTime(2009, 02, 12, 17, 00, 00));

            laConference.AjouterSession(session1);
            laConference.AjouterSession(session2);
            laConference.AjouterSession(session3);

            Assert.That(laConference.Sessions.Count, Is.EqualTo(3));

            Assert.That(laConference.Sessions[0].DateHeureDebut, Is.EqualTo(session1.DateHeureDebut));
            Assert.That(laConference.Sessions[1].DateHeureDebut, Is.EqualTo(session2.DateHeureDebut));
            Assert.That(laConference.Sessions[2].DateHeureDebut, Is.EqualTo(session3.DateHeureDebut));
        }

        [Test]
        [ExpectedException(typeof(PlageHoraireHorsBorneException))]
        public void SessionHorsBorne()
        {
            var session1 = new Session(new DateTime(2009, 02, 09, 08, 00, 00), new DateTime(2009, 02, 18, 19, 00, 00));

            laConference.AjouterSession(session1);
        }
    }
}
